﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Controls.Maps;
using System.Device.Location;

namespace DeleteMe
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void btnRoadMode_Click(object sender, RoutedEventArgs e)
        {
            this.map1.Mode = new RoadMode();
            GeoCoordinate cor = new GeoCoordinate();
        }

        private void btnAerialMode_Click(object sender, RoutedEventArgs e)
        {
            this.map1.Mode = new AerialMode();
        }

        private void btnZoomInt_Click(object sender, RoutedEventArgs e)
        {
            this.map1.ZoomLevel = this.map1.ZoomLevel++;
        }

        private void btnZoomOut_Click(object sender, RoutedEventArgs e)
        {
            this.map1.ZoomLevel = this.map1.ZoomLevel--;
        }

        private void btnMove_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/pgEnterGeo.xaml", UriKind.Relative));
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            double latitude = Convert.ToDouble(Application.Current.Resources["latitude"]);
            double longitude = Convert.ToDouble(Application.Current.Resources["longitude"]);

            GeoCoordinate geo = new GeoCoordinate(latitude, longitude);
            this.map1.SetView(geo, this.map1.ZoomLevel);
        }
    }
}